#ifndef NETSERVER_H_
#define NETSERVER_H_

#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/wait.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <sys/ioctl.h>
#include <iostream>
using namespace std;
class NetServer {
public:
	NetServer();
	virtual ~NetServer();
	void CreateConnect();
	void CheckConnect();
	void RevHello(char* str,int para[]);
	void SendHelloToo();
protected:
	void AcceptConnect();
	void HandlePacket();
	bool CheckBuff(char* str,int num);
	void DividePacket(char* str);
	void HandlePacketHead(char** str,int param[]);
	void SendPacket(string str);
private:
#define MAXBUF 1024
	char buff[MAXBUF];
	int sockfd,clientfd;
	sockaddr_in clientAddr;
	socklen_t len;
	bool connectFlag;
};
#endif /* NETSERVER_H_ */